# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.NetworkServices.V1.Model.HttpRouteCorsPolicy do
  @moduledoc """
  The Specification for allowing client side cross-origin requests.

  ## Attributes

  *   `allowCredentials` (*type:* `boolean()`, *default:* `nil`) - In response to a preflight request, setting this to true indicates that the actual request can include user credentials. This translates to the Access-Control-Allow-Credentials header. Default value is false.
  *   `allowHeaders` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the content for Access-Control-Allow-Headers header.
  *   `allowMethods` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the content for Access-Control-Allow-Methods header.
  *   `allowOriginRegexes` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the regular expression patterns that match allowed origins. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax.
  *   `allowOrigins` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the list of origins that will be allowed to do CORS requests. An origin is allowed if it matches either an item in allow_origins or an item in allow_origin_regexes.
  *   `disabled` (*type:* `boolean()`, *default:* `nil`) - If true, the CORS policy is disabled. The default value is false, which indicates that the CORS policy is in effect.
  *   `exposeHeaders` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the content for Access-Control-Expose-Headers header.
  *   `maxAge` (*type:* `String.t`, *default:* `nil`) - Specifies how long result of a preflight request can be cached in seconds. This translates to the Access-Control-Max-Age header.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowCredentials => boolean() | nil,
          :allowHeaders => list(String.t()) | nil,
          :allowMethods => list(String.t()) | nil,
          :allowOriginRegexes => list(String.t()) | nil,
          :allowOrigins => list(String.t()) | nil,
          :disabled => boolean() | nil,
          :exposeHeaders => list(String.t()) | nil,
          :maxAge => String.t() | nil
        }

  field(:allowCredentials)
  field(:allowHeaders, type: :list)
  field(:allowMethods, type: :list)
  field(:allowOriginRegexes, type: :list)
  field(:allowOrigins, type: :list)
  field(:disabled)
  field(:exposeHeaders, type: :list)
  field(:maxAge)
end

defimpl Poison.Decoder, for: GoogleApi.NetworkServices.V1.Model.HttpRouteCorsPolicy do
  def decode(value, options) do
    GoogleApi.NetworkServices.V1.Model.HttpRouteCorsPolicy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.NetworkServices.V1.Model.HttpRouteCorsPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
